package com.yilu.driver.mvp.presenter;


import android.content.Context;

import com.is.common.retrofitrxcache.RxCacheResult;
import com.is.common.rx.RxSubscriber;
import com.yilu.driver.entity.ScroeRegisterResponse;
import com.yilu.driver.mvp.contract.ScoreRegisterContract;

import org.json.JSONObject;

/**
 * 成绩登记
 *
 * @author Administrator
 * @date 2017/4/13 0013
 */

public class ScoreRegisterPresenter extends ScoreRegisterContract.Presenter {
    private Context mContext;

    public ScoreRegisterPresenter(Context mContext) {
        this.mContext = mContext;
    }

    @Override
    public void scoreRegister(JSONObject json) {
        mRxManager.add(mModel.scoreRegister(json).subscribe(new RxSubscriber<RxCacheResult<ScroeRegisterResponse>>(mContext, false) {

            @Override
            protected void _onNext(RxCacheResult<ScroeRegisterResponse> scroeRegisterResponseRxCacheResult) {
                mView.retureScoreRegister(scroeRegisterResponseRxCacheResult.getResultModel());
            }

            @Override
            protected void _onError(String message) {

            }
        }));
    }
}
